I have implemented access to OneDrive files using the Graph SDK from https://github.com/microsoftgraph/msgraph-sdk-android
For Authentication, I am using the same approach as in the Connect sample which uses the MSAL library, i.e. compile ('com.microsoft.identity.client:msal:0.1.+')in the build.gradle file.
I am calling mPublicClientApp.acquireToken with
String[] scopes = {"offline_access", "https://graph.microsoft.com/Files.ReadWrite","https://graph.microsoft.com/User.Read"}; and successfully retrieve accessTokens for both personal accounts and business accounts.
Next, I want to store a file on the user's OneDrive using
client.getDrive()
.getRoot()
.getItemWithPath("file.txt")
.getContent()
.buildRequest()
.put(data);
which works as expected with a personal account but fails with 403: Forbidden when using my business account (which BTW is the user of the app in the Azure portal). Similarly, I get 404: Not found if I try to get the DriveItem for a file which does exist (and that works for the personal account as well).
Is there anything wrong with my code or does it look like wrong configuration of the app? (I am using the "preview mode" in Azure portal). The permissions I have added are
Files.ReadWrite
Delegiert
Have full access to user files
-
offline_access
Delegiert
Access user's data anytime
-
User.Read
Delegiert
Sign in and read user profile
-
User.ReadWrite
Delegiert
Read and write access to user profile
-
This is my full manifest (with some IDs removed):
{
"id": "...",
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": 2,
"allowPublicClient": true,
"appId": "...",
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2018-12-24T08:51:51Z",
"groupMembershipClaims": null,
"identifierUris": [
"api://..."
],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "...",
"oauth2AllowIdTokenImplicitFlow": false,
"oauth2AllowImplicitFlow": false,
"oauth2Permissions": [
{
"adminConsentDescription": "blub",
"adminConsentDisplayName": "bla",
"id": "d3659b01-433e-44eb-ab39-9ee9c19f7fe8",
"isEnabled": true,
"lang": null,
"origin": "Application",
"type": "User",
"userConsentDescription": null,
"userConsentDisplayName": "read files",
"value": "Files.ReadWrite"
}
],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"preAuthorizedApplications": [],
"publisherDomain": "crocoapps.onmicrosoft.com",
"replyUrlsWithType": [
{
"url": "https://login.microsoftonline.com/common/oauth2/nativeclient",
"type": "InstalledClient"
},
{
"url": "msal8374f.................d9b2://auth",
"type": "InstalledClient"
},
{
"url": "https://login.live.com/oauth20_desktop.srf",
"type": "InstalledClient"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "7427e0e9-2fba-42fe-b0c0-848c9e6a8182",
"type": "Scope"
},
{
"id": "5c28f0bf-8a70-41f1-8ab2-9032436ddb65",
"type": "Scope"
},
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
},
{
"id": "b4e74841-8e56-480b-be8b-910348b18b4c",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADandPersonalMicrosoftAccount",
"tags": [],
"tokenEncryptionKeyId": null
}
I think your replyUrlsWithType values aren't holding the correct values. This list should hold the URLs to which Azure AD will redirect to once a token is issued.
Taken from Azure Active Directory app manifest:
replyUrlsWithType
This multi-value property holds the list of registered redirect_uri values that Azure AD will accept as destinations when returning tokens. Each uri value should contain an associated app type value. Supported type values are: Web, InstalledClient.
Hope it helps!
Related
I want to know that , Is it possible that we can access cookies from an app (android) for example - Currently i am logged in , in amazon videos . I want to access cookies (json id) or particularly like this:-
[
{
"domain": ".primevideo.com",
"expirationDate": 2183886856,
"hostOnly": false,
"httpOnly": true,
"name": "at-main-av",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "Atza|IwEBII7su3R9CsArd2BfylvT5To5LaOLd2gFKOn23APyjsGwk2ieHxH4PXzpHiZSRDXAJJEpRrE-RzYYFFAsLMKthk9ZX3SJ1WEWFzwxPEOhAGZiQO_e5x-sTNRyLbM8cJZZkBX6z738zkb0XLWGUFbY6Ny0Ls0ll9CcpgnhF9DAaHuibw7M9qBGdeNHREkEe2lrqoKu8xk1HbQbjMS59H43okkqRFtifAMmk4HNINlAPwJ7XooorOlZ9Nw48xgzd_m5j4yVz59nFCsUvGh9XF3DJjQidagWXnLTj2zSOYeLNdSu6ChedMo6CdQtXOGJN7vwfQMPT_A0L3KzXt_h38YRn8zDAz-y-r2TEzWV86FxmkZGycI2BeQhYZ6sDEG_7RwRwGpVtd33dCB1C6GMim5cXD4pluwO0BU3-N-kL1VqHP9FhnxFhvKuK4xQi72Mt4_YVcs",
"id": 1
}
]
I filled in the necessary information in my class but I do not know how to test it. Nothing indicates it in the documentation. Moreover it refers to 2 variables MERCHANT_HOSTED_SIGNIN & MERCHANT_HOSTED_SIGNUP but impossible to know where they are!
For information, a part of my loyaltyClass :
"discoverableProgram": {
"kind": "walletobjects#discoverableProgram",
"merchantSignupInfo": {
"signupWebsite": {
"kind": "walletobjects#uri",
"uri": "https://mywebsite.com/googlePay/signup/",
"description": "My description"
},
"signupSharedDatas": [
"firstName",
"lastName",
"streetAddress",
"addressLine1",
"addressLine2",
"addressLine3",
"city",
"state",
"zipcode",
"country",
"email",
"phone"
]
},
"merchantSigninInfo": {
"signinWebsite": {
"kind": "walletobjects#uri",
"uri": "https://mywebsite.com/googlePay/signin/"
}
},
"state": "trustedTesters"
}
I had to contact the Google Pay Passes team to activate registration and login.
I'm trying to set up CI for Gradle based Android project with Bamboo. Tutorial here work just work great for successful build.
For release note following I figure out to get Git log between two revision number.
git log ${bamboo.repository.previous.revision.number}..${bamboo.repository.revision.number}
But how to get last successful build git_revision number & current one.
Any suggestion ?
This involves scripting and utilizing REST API of Bamboo https://docs.atlassian.com/bamboo/REST [Choose the version you are working with]
To get all the build results, you need to make a call to:
[GET] <basepath>/rest/api/latest/result/{projectKey}-{buildKey}
Where, basepath is http://myhost.com:8085 OR http://myhost.com:8085/bamboo
Resulting in below:
{
"results": {
"size": 8,
"expand": "result",
"start-index": 0,
"max-result": 25,
"result": [
{
"link": {
"href": "<basepath>/rest/api/latest/result/{projectKey}-{buildKey}-{buildNumber}",
"rel": "self"
},
"plan": {
"shortName": "xyz",
"shortKey": "{buildKey}",
"type": "chain",
"enabled": true,
"link": {
"href": "<basepath>/rest/api/latest/plan/DS-ASVCCRED",
"rel": "self"
},
"key": "{projectKey}-{buildKey}",
"name": "ABCD",
"planKey": {
"key": "{projectKey}-{buildKey}"
}
},
"buildResultKey": "{projectKey}-{buildKey}-{buildNumber}",
"lifeCycleState": "Finished",
"id": 198039818,
"key": "{projectKey}-{buildKey}-{buildNumber}",
"planResultKey": {
"key": "{projectKey}-{buildKey}-{buildNumber}",
"entityKey": {
"key": "{projectKey}-{buildKey}"
},
"resultNumber": 45
},
"state": "Failed",
"buildState": "Failed",
"number": 45,
"buildNumber": 45
},
If JSON output is desired, just add Accept=application/json header while making a call.
This will return latest 25 build results in a sequence with the latest result being the first. You may go through this results and decide which two build results you are interested in.
Once you decide, you make additional calls to get change set (commit details) captured by bamboo for that particular build.
[GET] <basepath>/rest/api/latest/result/{projectKey}-{buildKey}/{buildNumber : ([0-9]+)|(latest)}?expand=changes
This will give you detailed commit description as below:
"changes": {
"size": 3,
"expand": "change",
"change": [
{
"author": "1234",
"changesetId": "7f76c41a7ff48f679a91d0fa2810ef3398121dc6"
},
{
"author": "abcd",
"changesetId": "104d8b7af9538599a02006005314033c8017e804"
},
{
"author": "cdef",
"changesetId": "d21aef9f3745257aa501425fc31ebd0c6b33f608"
}
],
"start-index": 0,
"max-result": 3
},
And then you can perform
git log <changesetId>...<changesetId>
I am developing hybrid app using cordova, app is intergated with facebook for which i used android SDK.
I need uid of friends of user, for I am using following fql
SELECT name,uid
FROM user
WHERE uid IN (SELECT target_id
FROM connection
WHERE source_id=me() and is_following=1)
ORDER BY name Asc
which is showing different uid in graph API Explorer and in logcat(android ide)
result in graph API Explorer
{
"data": [
{
"name": "Bharata Dumbo",
"uid": "817899964906568"
},
{
"name": "Deendayal Sharma",
"uid": "807134486015575"
},
{
"name": "Indravadan Intwala",
"uid": "813727452007073"
},
{
"name": "Manisha Parmar",
"uid": "10205158153335480"
},
{
"name": "Nitin Shah",
"uid": "1260451067"
},
{
"name": "Nitin Shah",
"uid": "100005623513169"
},
{
"name": "Smita Vora",
"uid": "323986007788625"
}
]
}
where as result in logcat::
Response getPageLike: `{"data":[{"uid":"100000597166472","name":"Bharata Dumbo"},{"uid":"792885570773800","name":"Deendayal Sharma"},{"uid":"813635845349567","name":"Indravadan Intwala"},{"uid":"10204471863338659","name":"Manisha Parmar"},{"uid":"1260451067","name":"Nitin Shah"},{"uid":"100005623513169","name":"Nitin Shah"},{"uid":"316474181873141","name":"Smita Vora"}]}`
Probably your app is a Graph API >=v2.0 app, that means it uses app-scoped ids instead of global ids as with v1.0.
The Graph Explorer sometimes inherently uses v1.0 (global ids respectively), even if another version is selected from the pulldown.
See
https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api
I want to fetch the Network list and its associated email Address from Facebook in Android. I am using the Facebook SDK for Android. But in response JSON from the Facebook, I am not getting the Network Name and the associated email address. Currently following permission are given.
Utility.mFacebook.authorize(LoginActivity.this,
new String[] { "publish_stream","read_stream", "offline_access","user_education_history", "email" },
Facebook.FORCE_DIALOG_AUTH,
facebookListener.new LoginDialogListener())
UPDATE: From Facebook developer site we can get network name in affiliation here
affiliations - The list of network affiliations, as affiliation elements, each of which contain year, type, status, name, and nid child elements. If no affiliations are returned, this element will be blank. The user's primary network (key: nid) will be listed first.
getting the following response in JSON format, but no affiliation tag in response,
{
"work": [
{
"employer": {
"id": "xxxxxxxxxxxx",
"name": "xyz"
},
"start_date": "0000-00",
"end_date": "0000-00"
}
],
"locale": "en_US",
"link": "http://www.facebook.com/abc.xyz.12",
"education": [
{
"type": "College",
"school": {
"id": "112520115426955",
"name": "University of Pennsylvania"
}
}
],
"updated_time": "2012-11-01T06:31:14+0000",
"id": "0000000000000000",
"first_name": "XYZ",
"timezone": 5.5,
"username": "abc.xyz.12",
"email": "abc#xyz.com",
"verified": true,
"name": "XYZ ABC",
"last_name": "ABC",
"gender": "male"
}
Please let me know, is there any permission required for same. or any other way to get this.
Thanks in Advance!.
This is the FQL query to get an user's affiliation:
select affiliations from user where uid=YOUR_UID_HERE
Example link to graph api explorer with the FQL query below.
https://developers.facebook.com/tools/explorer/?fql=select%20affiliations%20from%20user%20where%20uid%3D1060290170%0A%0A