I want to use meteor developer accounts for an app, but it seems there absolutely is no documentation regarding what permissions or options are available.
Can I receive the user email? How?
Can I pass any options to the endpoint in order to customize the user experience? (There’s some reference to userEmail or loginHint in the source, but no explanation there either )
Where is the documentation?
cc @sakulstra I think you’d be interested in this topic, too
1 Like
Assuming you’ve set up your app on https://www.meteor.com/account-settings and configured the service parameters accordingly, when you login your user object has a services['meteor-developer']
object:
{
"accessToken": "xxxxxxxxxxxxxxxx",
"expiresAt": null,
"username": "robfallows",
"emails": [
{
"address": "xxxxxx@gmail.com",
"primary": true,
"verified": true
},
{
"address": "xxxxx@xxxxxx.co.uk",
"verified": true
}
],
"id": "xxxxxxxxxxxxxxxxx"
}
Is that any help?
1 Like
The docs are definitely lacking. Taking a look at the accounts-oauth
source might help. For example:
/**
* @name loginWith<ExternalService>
* @memberOf Meteor
* @function
* @summary Log the user in using an external service.
* @locus Client
* @param {Object} [options]
* @param {String[]} options.requestPermissions A list of permissions to request from the user.
* @param {Boolean} options.requestOfflineToken If true, asks the user for permission to act on their behalf when offline. This stores an additional offline token in the `services` field of the user document. Currently only supported with Google.
* @param {Object} options.loginUrlParameters Provide additional parameters to the authentication uri. Currently only supported with Google {@url https://developers.google.com/identity/protocols/OpenIDConnect#authenticationuriparameters}.
* @param {String} options.loginHint An email address that the external service will use to pre-fill the login prompt. Currently only supported with Meteor developer accounts and Google accounts. If used with Google, the Google User ID can also be passed.
* @param {String} options.loginStyle Login style ("popup" or "redirect", defaults to the login service configuration). The "popup" style opens the login page in a separate popup window, which is generally preferred because the Meteor application doesn't need to be reloaded. The "redirect" style redirects the Meteor application's window to the login page, and the login service provider redirects back to the Meteor application which is then reloaded. The "redirect" style can be used in situations where a popup window can't be opened, such as in a mobile UIWebView. The "redirect" style however relies on session storage which isn't available in Safari private mode, so the "popup" style will be forced if session storage can't be used.
* @param {String} options.redirectUrl If using "redirect" login style, the user will be returned to this URL after authorisation has been completed.
* @param {Function} [callback] Optional callback. Called with no arguments on success, or with a single `Error` argument on failure. The callback cannot be called if you are using the "redirect" `loginStyle`, because the app will have reloaded in the meantime; try using [client-side login hooks](#accounts_onlogin) instead.
* @importFromPackage meteor
*/
// Allow server to specify a specify subclass of errors. We should come
// up with a more generic way to do this!
var convertError = function (err) {
if (err && err instanceof Meteor.Error &&
This helps explain the intent of loginHint
(userEmail
was deprecated ).
1 Like
Don’t know what I did wrong exactly, but now after executing meteor reset
and relogin via meteor-developers i also have email[1] instead of email[0]. So at least this is working now
2 Likes
Thank you guys, this has really been helpful.
Now the only missing thing is a list of values we can pass to requestPermissions!
1 Like