How to mint an NFT using `/sign_url` REST API of NEAR? - nearprotocol

We're building a Marketplace in NEAR blockchain. Currently, integrating the mint feature.
We have build a NFT contract and deployed to our testnet account. Reference: https://examples.near.org/NFT
We need help with /sign_url API. It generates a link to NEAR Wallet with provided transaction details. May be used to redirect user to the wallet and perform a transaction without generation application-specific keys and granting access:
We have generated approve transaction URL using /sign_url API:
By opening and signing generated approve transaction URL and getting this error:
{"index":0,"kind":{"ExecutionError":"Smart contract panicked: panicked at 'assertion failed: `(left == right)`\n left: `\"mamba11.testnet\"`,\n right: `\"mamba-marketplace-v1.testnet\"`: Unauthorized', /home/gitpod/.cargo/registry/src/github.com-1ecc6299db9ec823/near-contract-standards-3.2.0/src/non_fungible_token/core/core_impl.rs:348:9"}}
Please help us to solve this error.

I had the same issue when i was using mint function inside nft_mint(). The solution was to change mint function to internal_mint according to this example : https://github.com/near/near-sdk-rs/blob/master/examples/non-fungible-token/nft/src/lib.rs#L99 , and without checking owner_id at 98 row! Also you will need to change your near-sdk version to > 4.0.0 and near-contract-standarts to > 4.0.0. And i changed receiver_id type from ValidAccountId to AccountId.
Here are docs with description of internal_mint and mint functions https://github.com/near/near-sdk-rs/blob/master/near-contract-standards/src/non_fungible_token/core/core_impl.rs#L325

Related

Two-factor Authentication With fastlane

Im releasing my app to firebase distribution throw Fastlane while using CI machine.
Im facing an issue with the 2FA.
Im using Match to retrieve my certificates.
This is what I have under "Appfile"
app_identifier "com.example.example" # the bundle
apple_id "appleAcount#gmail.com" # Your Apple
team_id "abcd..." # Developer Portal Team ID
ENV["FASTLANE_USER"] = "appleAcount#gmail.com"
ENV["MATCH_PASSWORD"] = ""
ENV["FASTLANE_PASSWORD"] = ""
ENV["FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"] = ""
This is the error I'm receiving:
Two-factor Authentication (6 digits code) is enabled for account
'appleAcount#gmail.com' More information about Two-factor
Authentication: https://support.apple.com/en-us/HT204915
If you're running this in a non-interactive session (e.g. server or
CI) check out
https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification
(Input sms to escape this prompt and select a trusted phone number
to send the code as a text message)
(You can also set the environment variable
SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER to automate this) (Read more
at:
https://github.com/fastlane/fastlane/blob/master/spaceship/docs/Authentication.md#auto-select-sms-via-spaceship_2fa_sms_default_phone_number)
Please enter the 6 digit code:
I have read this "https://docs.fastlane.tools/best-practices/continuous-integration/" but with no luck. can anyone help me solve this issue?
The fastlane team did a great job ❤ in recent releases (from 2.157.0 to 2.163.0 so far) to support the use of an API key for App Store Connect API in many actions (pilot, deliver, match, etc. - the status for each tool is available here).
Using an API key removes the need to provide an Apple account to authenticate and authorize the fastlane actions to do their operations on App Store Connect, which also means that you will no longer be fighting with 2 factor issues on your CI machine or have to manually regenerate a session via fastlane spaceauth when it becomes invalid.
From App Store Connect API Key page:
Generating an API key allows you to configure, authenticate, and use one or more Apple services for that key. Keys don’t expire, but can’t be modified to access more services once created. You can have a maximum of 50 active keys at a time
There are other benefits of using an API key and it is the recommended solution as explained in the fastlane documentation:
fastlane has historically used Apple IDs with username and password to
authenticate using a cookie-based web session. fastlane will continue
using this same cookie-based web session to authenticate with an
unofficial version of the App Store Connect API.
However, it is recommended to use the API Key authentication when you
are able to. The benefits include:
No 2FA needed
Better performance
Documented API
Increased reliability
I will not detail the steps to set up and use an API key here as it is already well explained in the documentation but here are the main steps:
Create a new API key from App Store Connect (you must have the "Account Holder" role to create one) and assign it the App Manager role (cf. Role permissions documentation),
Store the key and its info on your CI,
In your Fastfile, call the app_store_connect_api_key action with the values stored in 2.
Pass the value returned by 3. as an api_key parameter when you call an action, or let the action retrieve its value by itself from the lane context (if it supports it).
2FA problem due to invalid session:
Should vanish :)
You need to set up a environment variable 'FASTLANE_SESSION'='---\n....\n' token.
To get this token you need to authenticate manually using this command:
fastlane spaceauth -u YOUR_APP_STORE_EMAIL
example fastlane spaceauth -u joe#test.com.
You will need to revalidate every 2-3 weeks (some say 30 days) your session. The process is kinda of a pain right now.
Create a new App Store Connect API Key in the Users page
For more info, go to the App Store Connect API Docs
Give your API Key an appropriate role for the task at hand. You can read more about roles in Permissions in App Store Connect
Download the newly created API Key file (.p8)
This file cannot be downloaded again after the page has been refreshed
Add key in your project
lane :release do
api_key = app_store_connect_api_key(
key_id: "D383SF739",
issuer_id: "6053b7fe-68a8-4acb-89be-165aa6465141",
key_filepath: "./AuthKey_D383SF739.p8",
duration: 1200, # optional (maximum 1200)
in_house: false # optional but may be required if using match/sigh
)
pilot(api_key: api_key)
end
more details

Can/Should I hide the details of Error 403: org_internal in google login?

I am using Google's login API for a project that needs to be internal to my organization. When I tested to see what happens if I try to login with an account that is not part of that organization, this error showed up:
Error message image on https://i.stack.imgur.com/bnXNw.png
This error shows the client id provided by my API panel on my developer account.
Is showing that information safe? If not, what could I do to hide it?
Thank you in advance!
The client identifier [1] and everything else on the error page is not considered a secret. The error message has two uses: to lock your app down for internal usage and to allow users to use that information to escalate to you, the developer, or their admin that they need access to a particular app if they have a legitimate need for it. For the latter, it is important for users to be able to identify apps, typically using the client ID.
[1] https://www.rfc-editor.org/rfc/rfc6749#section-2.2

Which group should a user be a part of in order to make API call to Oracle Cloud Infrastructure?

While making Rest API calls I am getting this error
Your credentials could not be authenticated: "Credentials are
missing. You will not be permitted access until your credentials can be
verified."
I have cross-verified my private key and apiKey, all the credentials are correct. Still, I am getting this error. If anyone could help me how this error could be resolved, it would be really great.
Can you share some more details? For example, which API/service are you trying to access, what is the endpoint, your tenancy id, and most importantly opc-request-id if you have one for the failed call.
Please engage support team to create a support ticket too.

I keep getting an error that my app needs to be verified when either I or another user try to authorize with OAuth2. What does that mean?

I received this error when trying to authorize my app with my own account:
Your project is trying to access scopes that need to go through the verification process.
{invalid=https://www.googleapis.com/auth/contacts}
If you need to use one of these scopes, submit a verification request. Learn More
When I use a different account, the error message is different:
This app hasn’t been verified to access:
{invalid=https://www.googleapis.com/auth/contacts}
Are you the developer? If this project needs these scopes, sign in to an account with access to edit your project and try again.
If not, contact the developer for help.
As per the announcement on May 11, 2017, publicly available applications with access to certain user data must pass review. If you see an access error for your app, submit a request using our OAuth Developer Verification form.
For personal-use apps and those you are testing, join the Google group Risky Access Permissions By Unreviewed Apps, which allows you to approve data access for personal and testing accounts. See the Google API Services User Data Policy for more information.
UPDATE: Corrected broken link to form.

google adwords api with google-adwords-api gem

I am trying to access google adwords api with 'google-adwords-api' ruby gem.
I have configured as per required. I have also set an test mcc account and api application. But still I am not able to access the api. It is giving following error
QuotaCheckError.ACCOUNT_INACTIVE
Also I am trying to set the environment to sandbox which gives following error
Environment 'SANDBOX' does not support version 'v201306' (AdsCommon::Errors::Error)
In documentationn it is mentioned that we can access api with test account even before approval.
Thanks in advance
I got fixed this.
The developer token needed for accessing the ad-words api should be created from production account and not from test account.

Resources