hello.js icon indicating copy to clipboard operation
hello.js copied to clipboard

Windows Live is depreciated, migrate to Microsoft Graph

Open JadedBlueEyes opened this issue 6 years ago • 5 comments

Move to Azure AD v2, see MSAL js for reference implimentation in Typescript.

JadedBlueEyes avatar Jan 09 '19 18:01 JadedBlueEyes

https://aka.ms/livesdkmigration

JadedBlueEyes avatar Jan 09 '19 18:01 JadedBlueEyes

We recently getting some errors due to this migration. Please upgrade. If anyone successfully migrated existing codebase to graph api. Please let us know.

ratheeshkannan avatar Mar 20 '19 14:03 ratheeshkannan

@MrSwitch, this is a serious isssue. If this repository is unmaintained, please mark it as so on the repository and documentation.

JadedBlueEyes avatar Apr 21 '19 18:04 JadedBlueEyes

I'm on day 3 trying to make hellojs (1.16 and 1.18) work with MS Graph and Typescript. Very frustrating, seeing plenty of errors, e.g.:

When basename is not configured:

TypeError: cannot use 'in' operator to search for 'paging' in ' ...' hello.all.js:2011 getPath hello.all.js:2011 onload hello.all.js:2277

When basename is configured:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.graph.microsoft.com/v1.0/me?access_token=...

here's the config I'm testing, after checking various examples online:

hello.init(
    {
        msgraph: Config.appId
    },
    {
        display: "page",
        redirect_uri: Config.redirectUri,
        scope: Config.scope
    });

hello.init({
    msgraph: {
        name: "Microsoft Graph",
        oauth: {
            version: 2,
            auth: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
        },
        scope_delim: " ",
        form: false,
        //base: "https://www.graph.microsoft.com/v1.0/",
    }
});

dluc avatar Apr 26 '19 02:04 dluc

New to hello.js, been looking into this as well trying to get MS Graph working.

@dluc One issue, I don't think the address should have www on the domain.

Ghryphen avatar May 08 '19 21:05 Ghryphen

Did any of you manage to migrate?

Update: ok so I got it working by creating my own instead of trying to extend the windows one.

I had to do something like this to get the basic working:

microsoft: {
			oauth: {
				version: 2,
				auth: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
				grant: "https://login.microsoftonline.com/common/oauth2/v2.0/token",
			},
			// Authorization scopes
			scope: {
				basic: "User.Read", // this works but openid doesn't nor the information shown in the migrate page in previous post
				email: "Mail.Read",
				//birthday: 'wl.birthday',
				events: "Calendars.Read",
				// photos: 'Files.Read',
				// videos: 'wl.photos',
				// friends: 'wl.contacts_emails',
				files: "Files.Read",
				//publish: 'wl.share',
				//publish_files: 'wl.skydrive_update',
				//share: 'wl.share',
				create_event: "Calendars.ReadWrite,Calendars.ReadWrite",
				offline_access: "offline_access",
			},
			base: "https://graph.microsoft.com/v1.0/",
			scope_delim: " ",
			/**
			 *
			 * @param p
			 */
			xhr: function (p) {
				p.headers = {
					"Content-Type": "application/json",
					"Authorization": `Bearer ${get(p, "authResponse.access_token")}`,  // this is required for their authentication (i am using lodash here)
				};

				return true;
			},
			wrap: {
				/**
				 *
				 * @param o
				 * @param headers
				 * @param req
				 */
				me: (o, headers, req) => {
					if (o.id) {
						o.last_name = o.surname || null;
						o.first_name = o.givenName || null;
						o.email = o.userPrincipalName; // i am trying to find out why o.mail is null at the moment
					}

					return o;
				},
			},
		},

I leave this as a example here in case anyone has the same issues or want to implement something for this.

simplecommerce avatar Jan 07 '23 15:01 simplecommerce