NextAuth Documentation refers to a version that doesnt exist? - next-auth

I am trying to implement the following:
https://next-auth.js.org/tutorials/securing-pages-and-api-routes#nextjs-middleware
I want to list all my secure pages in the const config object. However on that page it references that 'since NextAuth 4.2....` Well the npmjs page only shows up to v4.17 - Is this why I can't get it to work? Why is it documenting something that we cannot even use yet?

Related

Confluence Cloud - How to update content status via the API

I'm struggling with how to find the content status of a page in Confluence.
My end goal is to be able to change/update via the API.
I've added the list of statuses already in the Manage space section. I have successfully pulled the content of a page as well as its properties, but I can’t seem to find where the content status is stored.
Here is the URI I'm using:
https://MyDomain.atlassian.net/wiki/rest/api/content/145468621376?expand=space,body.storage,view,version.status,container,extentions
That Status is not present in OOB Confluence, so I suppose it is some third-party app from Atlassian Marketplace and you need to check with their documentation how to interact with it.
Of course, you can directly use the REST API to get page content as a string (HTML) and change its content, e.g. using Python (Atlassian Python API’s documentation)
Page actions
def my_page = confluence.get_page_property(page_id, page_property_key)
def new_body = my_page.body.replace("<macro .....>", "<new status in HTML>")
confluence.update_or_create(parent_id, title, new_body, representation='storage')
Finally sorted it out with the help of Atlassian support. If their documentation was correct it would've been super easy to do this.
https://developer.atlassian.com/cloud/confluence/rest/api-group-content-states/#api-group-content-states
Heres the catch. when you GET the status you have to add on the parameter for status even though its optional. so your get string needs to look like this:
your-domain.atlassian.net/wiki/rest/api/content{id}/state?status=current
Same goes for setting the new state. You have to add on the status parameter to the uri.

Import API not working in sisense

I was trying to use the dashboard import API from v1.0 which can be found in the REST API reference. I logged in to http://localhost:8083/dev/api/docs/#/ , gave the correct authorization token, and a dash file in the body, and a 24 character importFolder and hit the Run button to fire the API. It returns 201 as HTTP response, which means the request was successful. However, when I go back to the homepage, I don't see any new dashboard imported in to the said folder. I have tried both cases, where the importFolder exists (already created manually be me), and does not already exist, where I expect the API to create it for me. Neither of these, however, create/import the dashboard
A few comments that should help you resolve this:
When running the command from the interactive API reference (swagger) you don't need the authentication token, because you're already logged in with an active session.
Make sure the json of your dashboard is valid, by saving it as a .dash file and importing via the UI
The folder field is optional - if you leave the field blank, the dashboard is imported to the root of your navigation/folders panel.
If you'd like to import to a specific folder, you'll need to provide the folder ID, not its name, which can be found several ways such as using the /api/v1/folders endpoint, where you can provide a name filtering field and use the oid property of the returned object as the value for the folder field in the import endpoint.
If you can't get this to work still, use chrome's developer tools to look at the outgoing request when you import from the UI and compare the request (headers, body and path) to what you're doing via swagger in order to find the issue.

Facebook login with Azure Service and get user info error

I've implemented facebook login following this blog https://ahoycoders.com/2015/07/09/xamarin-forms-social-authentication-with-azure-mobile-services-part-3/
That blog is based on old Azure portal.
But, I'm using new Azure portal.
1. In the new Azure portal I used Easy APIs option for creating custom API as mentioned in the blog.
2. I copied the scrip mentioned in the blog for my custom API and I'm using only Facebook.
I authenticated via Facebook and then called the following,
return await mobileService.InvokeApiAsync("getextrauserinfo", HttpMethod.Get, null);
Unfortunately, I'm getting the following error,
"Cannot read property 'getIdentities' of undefined"
I don't know what's wrong, please help me in fixing this.
currentUser is no longer obtained from request as .user, it is now request.azureMobile.user
They changed the method calls. It is also no longer getIdentities.
Its getIdentity.
A few other calls slightly changed as well.
I suggest anyone wanting to use that guide use console.log to see what each object actually returns and then switch out the old code for the right call.
Logic in that example should still be fine, just slightly different calls/names.

Facebook OAuth SSO Issue

I have a JavaEE Application. I am trying to implement OAuth.
But I am facing some strange issues:
As per the documentation to manually building the sign in web flow I have to provide a link like this https://www.facebook.com/dialog/oauth?client_id=1231298371123&display=popup&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fc%2Fportal%2Fauth%2Ffacebook_login%3F&scope=email,public_profile,user_birthday&response_type=code%20token which will open the dialog. But the dialog is not opening.
And when the SSO is successful FB is redirecting to the url given above but the problem is FB is appending the query strings like state, code, etc with #. Something like: http://localhost:8080/c/portal/auth/facebook_login?#state=ASDASDASDASD&access_token=EAANXZAlBTi........ Because for this I cannot get the parameters in Java.
Do any one came across this kind of issue.
Please help.
Not sure if I understood the question right but if you want to read the string after # you can use the following code
URI uri = new URI("http://test.com/#something=some");
String fragment = uri.getFragment();
fragment will be everything after #

How do I get the Explore and Stream section from the SoundCloud API

I can't seem to find the section in their api reference. I tried it as a searchquery but it doesn't seem to work. api.soundcloud.com/stream or /explore return a 404, so that doesn't work either
Thats actually not a part of the public API.
But its quite easy to grab your call from the dev console.
Thats an example call from my user:
https://api-v2.soundcloud.com/stream?user_id=e87647259112403eaa239b6e2c510e46&sc_a_id=e87647259112403eaa239b6e2c510e46&user_urn=soundcloud%3Ausers%3A1672444&promoted_playlist=true&limit=10&offset=0&linked_partitioning=1&client_id=02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea&app_version=a089efd
To make that call work, you need to modify the headers.
These answers may help you:
Retrieving the "recommended" playlist via API call?
soundcloud: Is api-v2 allowed to be used and is there documentation on it?
How to get "all" tracks related to an artist with Souncloud API
Using these endpoints does not go inline with SoundClouds TOS.